import React from 'react'
import { Table } from 'antd'
import PropTypes from 'prop-types'
import {withRouter} from "react-router-dom"
class IcsComponentsIdleGrid extends React.Component {
    state = {
    }
    OnDetail = (id) => {
        this.props.history.push("/business/detail/" + id)
    }
    componentDidMount () {
    }
    render () {
        return (
            <div className="manager-grid">
                <Table
                    dataSource={this.props.list}
                    pagination={false}
                    bordered
                    rowKey="id">
                    <Table.Column
                        title="商家ID"
                        width={120}
                        dataIndex="id"
                    />
                    <Table.Column
                        title="商家名称"
                        dataIndex="shop_name"
                        width={150}
                    />
                    <Table.Column
                        title="商家账号"
                        width={120}
                        dataIndex="user_name"
                    />
                    <Table.Column
                        title="商家行业"
                        width={120}
                        dataIndex="business"
                    />
                    <Table.Column
                        title="联系人"
                        width={120}
                        dataIndex="contact"
                    />
                    <Table.Column
                        title="联系电话"
                        width={150}
                        dataIndex="shop_tel"
                    />
                    <Table.Column
                        title="审核状态"
                        width={150}
                        dataIndex="audit_status"
                        render={(text) => {
                            let status = parseInt(text, 10)
                            if (status === 1) {
                                return '待审核'
                            } else if(status === 10) {
                                return '审核通过'
                            } else if(status === 20) {
                                return '审核拒绝'
                            }
                        }}

                    />
                    <Table.Column
                        title="商家启用状态"
                        width={120}
                        dataIndex="shop_status"
                        render={(text) => {
                            let status = parseInt(text, 10)
                            if (status === 1) {
                                return '启用'
                            } else if(status === 0) {
                                return '停用'
                            }
                        }}
                    />
                    <Table.Column
                        title="操作"
                        width={150}
                        render={(text, row) => {
                            return <a onClick={()=>this.OnDetail(row.id)}>查看</a>
                        }}
                    />
                </Table>
            </div>
        )
    }
}

IcsComponentsIdleGrid.propTypes = {
    list: PropTypes.any
}
export default withRouter(IcsComponentsIdleGrid)
